* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.chat-container {
    width: 1200px;
    height: 800px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: flex;
    overflow: hidden;
    position: relative;
}

.chat-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.chat-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.status {
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.status.connected {
    background: rgba(76, 175, 80, 0.8);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.status.disconnected {
    background: rgba(244, 67, 54, 0.8);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-top: 80px;
    margin-right: 300px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 30px;
    background: #f8f9fa;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.1) 0%, transparent 50%);
}

.message {
    margin: 15px 0;
    padding: 15px 20px;
    border-radius: 18px;
    max-width: 70%;
    word-wrap: break-word;
    position: relative;
    animation: fadeInUp 0.4s ease-out;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.own {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 8px;
}

.message.other {
    background: white;
    color: #333;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 8px;
}

.message.system {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    color: #8b4513;
    text-align: center;
    max-width: 100%;
    border-radius: 12px;
    font-weight: 500;
}

.message.error {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #c62828;
    text-align: center;
    max-width: 100%;
    border-radius: 12px;
    font-weight: 500;
}

/* 聊天消息样式 - 需要更具体的优先级 */
.message.CHAT.own {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 8px;
    border: none;
}

.message.CHAT.other {
    background: white;
    color: #333;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 8px;
}

.message.JOIN {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #2e7d32;
    text-align: center;
    max-width: 100%;
    border-radius: 12px;
    font-weight: 500;
}

.message.LEAVE {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    color: #e65100;
    text-align: center;
    max-width: 100%;
    border-radius: 12px;
    font-weight: 500;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.message-header strong {
    font-weight: 600;
    color: inherit;
}

.message.own .message-header strong {
    color: white;
}

.timestamp {
    font-size: 0.75rem;
    opacity: 0.7;
    color: inherit;
}

.message-content {
    word-wrap: break-word;
    line-height: 1.4;
}

.chat-input {
    padding: 25px 30px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 15px;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.chat-input input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.chat-input input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-input button {
    padding: 15px 25px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.chat-input button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.chat-input button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    background: #6c757d;
}

.chat-sidebar {
    width: 300px;
    background: white;
    border-left: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    margin-top: 80px;
}

.user-info {
    padding: 25px;
    border-bottom: 1px solid #e9ecef;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.user-info input {
    width: 100%;
    padding: 12px 18px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    background: white;
}

.user-info input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.user-info button {
    width: 100%;
    padding: 12px 18px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.user-info button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.user-info button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.online-users {
    flex: 1;
    padding: 25px;
}

.online-users h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.online-users h3::before {
    content: "👥";
    font-size: 18px;
}

.user-list {
    max-height: 400px;
    overflow-y: auto;
}

.user-item {
    padding: 12px 16px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    font-size: 14px;
    color: #333;
    border-left: 4px solid #667eea;
    animation: fadeInUp 0.4s ease-out;
    transition: all 0.3s ease;
    position: relative;
}

.user-item::before {
    content: "●";
    color: #4caf50;
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
}

.user-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.no-users {
    color: #6c757d;
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #dee2e6;
}

/* 滚动条样式 */
.chat-messages::-webkit-scrollbar,
.user-list::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track,
.user-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb,
.user-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.user-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .chat-container {
        width: 95%;
        height: 90vh;
    }
    
    .chat-sidebar {
        width: 250px;
    }
}

@media (max-width: 768px) {
    .chat-container {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        margin: 0;
    }
    
    .chat-sidebar {
        width: 200px;
    }
    
    .chat-header h1 {
        font-size: 1.4rem;
    }
    
    .chat-input {
        flex-direction: column;
        gap: 10px;
    }
    
    .chat-input button {
        width: 100%;
    }
    
    .message {
        max-width: 85%;
    }
} 